package com.bw.service.impl;

import com.alibaba.fastjson.JSON;
import com.bw.entity.Book;
import com.bw.service.BookService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
@Service
public class BookServiceImpl implements BookService {


    @Override
    public List<Book> selectBookList(String name) {
        System.out.println("selectBookList 的入参是：" + name);
        System.out.println("BookServiceImpl selectBookList 正在执行");
        List<Book> list = Arrays.asList(Book.builder().id(1).name("java入门").build(), Book.builder().id(2).name("python入门").build());

        System.out.println("selectBookList 的返参是：" + JSON.toJSONString(list));
        return list;
    }

    @Override
    public int addBook(Book book) {
        System.out.println("BookServiceImpl addBook 正在执行");
        return 1;
    }

    @Override
    public int updateBook(Book book) {

        System.out.println("BookServiceImpl updateBook 正在执行");
        return 1;
    }

    @Override
    public int delBook(Integer id) {


        System.out.println("BookServiceImpl delBook 正在执行");

        return 0;
    }
}
